remove unused argument to `Context::lib_profile`
authorAndy Russell <arussell123@gmail.com>
Fri, 2 Dec 2016 20:28:40 +0000 (15:28 -0500)
committerAndy Russell <arussell123@gmail.com>
Thu, 8 Dec 2016 21:11:19 +0000 (16:11 -0500)
src/cargo/ops/cargo_rustc/context.rs
src/cargo/ops/cargo_rustc/custom_build.rs
src/cargo/ops/cargo_rustc/job_queue.rs

index 09977ca300d30ad4ce26133ddf35e35287be25e5..b1690755f9656e2624cf137c41b7dab74e85c5e4 100644 (file)
@@ -597,7 +597,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
                         Ok(Unit {
                             pkg: pkg,
                             target: t,
-                            profile: self.lib_profile(id),
+                            profile: self.lib_profile(),
                             kind: unit.kind.for_target(t),
                         })
                     })
@@ -630,7 +630,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
                 Unit {
                     pkg: unit.pkg,
                     target: t,
-                    profile: self.lib_profile(id),
+                    profile: self.lib_profile(),
                     kind: unit.kind.for_target(t),
                 }
             }));
@@ -707,7 +707,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
             ret.push(Unit {
                 pkg: dep,
                 target: lib,
-                profile: self.lib_profile(dep.package_id()),
+                profile: self.lib_profile(),
                 kind: unit.kind.for_target(lib),
             });
             if self.build_config.doc_all {
@@ -753,7 +753,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
             Unit {
                 pkg: unit.pkg,
                 target: t,
-                profile: self.lib_profile(unit.pkg.package_id()),
+                profile: self.lib_profile(),
                 kind: unit.kind.for_target(t),
             }
         })
@@ -808,7 +808,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
     /// Number of jobs specified for this build
     pub fn jobs(&self) -> u32 { self.build_config.jobs }
 
-    pub fn lib_profile(&self, _pkg: &PackageId) -> &'a Profile {
+    pub fn lib_profile(&self) -> &'a Profile {
         let (normal, test) = if self.build_config.release {
             (&self.profiles.release, &self.profiles.bench_deps)
         } else {
@@ -821,10 +821,10 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
         }
     }
 
-    pub fn build_script_profile(&self, pkg: &PackageId) -> &'a Profile {
+    pub fn build_script_profile(&self, _pkg: &PackageId) -> &'a Profile {
         // TODO: should build scripts always be built with the same library
         //       profile? How is this controlled at the CLI layer?
-        self.lib_profile(pkg)
+        self.lib_profile()
     }
 
     pub fn rustflags_args(&self, unit: &Unit) -> CargoResult<Vec<String>> {
index e412b846ed9073b888facf352d7cad1cc2f313ed..5c697e92836773c8701383466c134f7ab314d45b 100644 (file)
@@ -97,7 +97,7 @@ fn build_work<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>)
     // environment variables. Note that the profile-related environment
     // variables are not set with this the build script's profile but rather the
     // package's library profile.
-    let profile = cx.lib_profile(unit.pkg.package_id());
+    let profile = cx.lib_profile();
     let to_exec = to_exec.into_os_string();
     let mut cmd = cx.compilation.host_process(to_exec, unit.pkg)?;
     cmd.env("OUT_DIR", &build_output)
index 5e35a7e10306cc378ed11d1351af5760a41d308a..f06a0bbebb6b1c25637c4e0128ead022b0840bd4 100644 (file)
@@ -198,9 +198,7 @@ impl<'a> JobQueue<'a> {
         }
 
         let build_type = if self.is_release { "release" } else { "debug" };
-        let profile = cx.ws.current_opt().map_or_else(Profile::default, |p| {
-            cx.lib_profile(p.package_id()).to_owned()
-        });
+        let profile = cx.lib_profile();
         let mut opt_type = String::from(if profile.opt_level == "0" { "unoptimized" }
                                         else { "optimized" });
         if profile.debuginfo {